﻿namespace Bzstd.Utility.Assertion;

/// <summary>
/// 数字断言类
/// </summary>
public static partial class Assert
{
	/// <summary>
	/// 正数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static long IsPositive(long value, string message)
	{
		IsTrue(value > 0, message);
		return value;
	}

	/// <summary>
	/// 负数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static long IsNegative(long value, string message)
	{
		IsTrue(value < 0, message);
		return value;
	}

	/// <summary>
	/// 非正数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static long IsNotPositive(long value, string message)
	{
		IsFalse(value > 0, message);
		return value;
	}

	/// <summary>
	/// 非负数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static long IsNotNegative(long value, string message)
	{
		IsFalse(value < 0, message);
		return value;
	}

	/// <summary>
	/// 零断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static long IsZero(long value, string message)
	{
		IsTrue(value == 0, message);
		return value;
	}

	/// <summary>
	/// 非零断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static long IsNotZero(long value, string message)
	{
		IsFalse(value == 0, message);
		return value;
	}

	/// <summary>
	/// 范围断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="min"></param>
	/// <param name="max"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static long Range(long value, long min, long max, string message)
	{
		IsTrue(value >= min && value < max, message);
		return value;
	}

	/// <summary>
	/// 正数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static double IsPositive(double value, string message)
	{
		IsTrue(value > 0, message);
		return value;
	}

	/// <summary>
	/// 负数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static double IsNegative(double value, string message)
	{
		IsTrue(value < 0, message);
		return value;
	}

	/// <summary>
	/// 非正数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static double IsNotPositive(double value, string message)
	{
		IsFalse(value > 0, message);
		return value;
	}

	/// <summary>
	/// 非负数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static double IsNotNegative(double value, string message)
	{
		IsFalse(value < 0, message);
		return value;
	}

	/// <summary>
	/// 零断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static double IsZero(double value, string message)
	{
		IsTrue(value == 0, message);
		return value;
	}

	/// <summary>
	/// 非零断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static double isNotZero(double value, string message)
	{
		IsFalse(value == 0, message);
		return value;
	}

	/// <summary>
	/// 范围断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="min"></param>
	/// <param name="max"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static double Range(double value, double min, double max, string message)
	{
		IsTrue(value >= min && value < max, message);
		return value;
	}

	/// <summary>
	/// 正数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static decimal IsPositive(decimal value, string message)
	{
		IsTrue(value > 0, message);
		return value;
	}

	/// <summary>
	/// 负数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static decimal IsNegative(decimal value, string message)
	{
		IsTrue(value < 0, message);
		return value;
	}

	/// <summary>
	/// 非正数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static decimal IsNotPositive(decimal value, string message)
	{
		IsFalse(value > 0, message);
		return value;
	}

	/// <summary>
	/// 非负数断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static decimal IsNotNegative(decimal value, string message)
	{
		IsFalse(value < 0, message);
		return value;
	}

	/// <summary>
	/// 零断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static decimal IsZero(decimal value, string message)
	{
		IsTrue(value == 0, message);
		return value;
	}

	/// <summary>
	/// 非零断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static decimal isNotZero(decimal value, string message)
	{
		IsFalse(value == 0, message);
		return value;
	}

	/// <summary>
	/// 范围断言
	/// </summary>
	/// <param name="value"></param>
	/// <param name="min"></param>
	/// <param name="max"></param>
	/// <param name="message"></param>
	/// <returns></returns>
	public static decimal Range(decimal value, decimal min, decimal max, string message)
	{
		IsTrue(value >= min && value < max, message);
		return value;
	}
}
